# encoding: utf-8
from flask_marshmallow import base_fields

from flask_restplus_patched import ModelSchema
from app.modules.common.schemas import BaseSchema
from .models import ZoneInfo


class ZoneBaseSchema(ModelSchema):
    class Meta:
        model = ZoneInfo
        fields = (
            'zone_id',
            'env_name',
            'zone_code',
            'zone_alias',
            'zone_title',
            'parent_code',
            'barrier_url',
            'current_status',
            'operate_group',
            'update_time',
            'expect_status',
            'check_status',
        )


class ZoneListSchema(BaseSchema):
    data = base_fields.Nested(
        ZoneBaseSchema,
        many = True
    )

    class Meta:
        fields = BaseSchema.Meta.fields + (
            'data',
        )
